import QtQuick 2.0
import QtQuick.Controls 1.4
import QtQuick.Controls 2.15 as QC2

BaseRect{
    color: Qt.rgba(89/255, 89/255, 89/255, 1)
    radius: 5

    property string labelTxt: ""
    property real value: 0
    property alias tf: tf
    signal setValue(real v)

    Row {
        id: row
        spacing: 0
        width: l.width+b1.width+b2.width+tf.width
        height: 22
        anchors.centerIn: parent

        Label {
            id: l
            text: labelTxt
            color: "white"
            anchors.verticalCenter: parent.verticalCenter
        }

        QC2.Button{
            id: b1
            text: "-"
            width: 20
            height: width
            anchors.verticalCenter: parent.verticalCenter
            onClicked: {
                tf.text = Number(tf.text)-1
            }
            autoRepeat: true
        }

        TextField{
            id: tf
            anchors.verticalCenter: parent.verticalCenter
            text: value
            onTextChanged: setValue(text)
        }

        QC2.Button{
            id: b2
            text: "+"
            width: 20
            height: width
            anchors.verticalCenter: parent.verticalCenter
            onClicked: {
                 tf.text = Number(tf.text)+1
            }
            autoRepeat: true
        }
    }
}

